import * as THREE from 'three'
import Experience from './Experience'
export default class Light {
    constructor() {
        this.experience = new Experience();
        this.scene = this.experience.scene;

        this.createDirectionLight(0,4,-1);
        this.createDirectionLight(-4,1,4);
        this.createAmbientLight();
    }

    // 创建平行光
    createDirectionLight(x, y, z) {
        const directionalLight = new THREE.DirectionalLight(0xffffff,0.5);
        directionalLight.position.set(x, y, z)
        const directionalLightHelper = new THREE.DirectionalLightHelper(directionalLight);
        this.scene.add(directionalLight);
        // this.scene.add(directionalLightHelper);
    }

    // 创建环境光
    createAmbientLight(){
        const ambient = new THREE.AmbientLight(0xffffff,0.5);
        this.scene.add(ambient);
    }
}